<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
  <script src="../vue.js"></script>
</head>

<body>
  <div id="app">
    {{username}}
  </div>

  <script>

    var user = {
      username: 'liuhuihui',
      age: 18,
      address: ""
    }


    // Object.freeze(user)

    var vm = new Vue({
      el: '#app',
      data: user,
      beforeCreate() {
        console.log('beforeCreate')
        console.log('usernme:', this.username)
        console.log(document.querySelector("#app"))
      },
      created() {
        console.log('created')
        console.log('usernme:', this.username)
        console.log(document.querySelector("#app"))
      },
      beforeMount() {
        console.log('beforeMount')
        console.log('usernme:', this.username)
        console.log(document.querySelector("#app"))
      },
      mounted() {
        console.log('mounted')
        console.log('usernme:', this.username)
        console.log(document.querySelector("#app"))
        setTimeout(() => {
          vm.$destroy();
        }, 3000)
      },
      beforeUpdate() {
        console.log('beforeUpdate')
      },
      updated() {
        console.log('updated')
      },
      beforeDestroy() {
        console.log('beforeDestroy')
      },
      destroyed() {
        console.log('destroyed')

      }



    })


  </script>


</body>

</html>